import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {
  remark: string,
  unityName: string,
  id?: number,
  flowCardId: number,
  projectName?: string,
  gatewayName?: string,
  gatewaySN?: string,
  commStatus: number,
  connetStatus?: number,
  status?: string,
  deviceNum?: number,
  flowCardNum?: string,
  rate?: number,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/device/gateway/v2/gateways';
const Url = '/business/device/gateway/v2/gateway';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
// 获取流量卡下拉框
export const getflowcardops = (params?: object) => {
  return http.request<commonResult<any>>("get", '/business/device/gateway/v2/flowcard-ops', {
    params
  });
}
//获取流量卡消息
export const getflowcardmsg = (params?: object) => {
  return http.request<commonResult<any>>("get", '/business/device/device/v2/flow', {
    params
  });
}